package com.mapapp.flutter_mapapp.util;

import android.app.Activity;
import android.content.pm.ActivityInfo;

import com.mapapp.flutter_mapapp.BuildConfig;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.internal.entity.CaptureStrategy;

public class SelectPhotoUtil {
    public static void openPhotoAlbum(Activity activity, int REQUEST_CODE_CHOOSE) {
        Matisse.from(activity)
                .choose(MimeType.of(MimeType.BMP, MimeType.JPEG, MimeType.PNG))
                .countable(true)
                .maxSelectable(9)
                .capture(true)
                .captureStrategy(new CaptureStrategy(true, BuildConfig.APPLICATION_ID + ".fileProvider"))
                .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
                .thumbnailScale(0.85f)
                .imageEngine(new MyGlideEngine())
                .forResult(REQUEST_CODE_CHOOSE);
    }

    public static void openPhotoAlbum(Activity activity, int REQUEST_CODE_CHOOSE, int max) {
        Matisse.from(activity)
                .choose(MimeType.of(MimeType.BMP, MimeType.JPEG, MimeType.PNG))
                .countable(true)
                .maxSelectable(max)
                .capture(true)
                .captureStrategy(new CaptureStrategy(true, BuildConfig.APPLICATION_ID + ".fileProvider"))
                .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
                .thumbnailScale(0.85f)
                .imageEngine(new MyGlideEngine())
                .forResult(REQUEST_CODE_CHOOSE);
    }
}
